package com.centaline.androidsalesblog.model.businissobject;

import android.os.Parcel;
import android.os.Parcelable;

import com.centaline.androidsalesblog.model.databaseobject.PostDo;

import java.util.ArrayList;

/**
 * 租售地图数据
 * Created by guilin on 16/4/12.
 */
public class PostMapBo implements Parcelable {

    private String cestCode;
    private String cestName;
    private ArrayList<PostDo> postDos;

    public PostMapBo(String cestCode, String cestName) {
        this.cestCode = cestCode;
        this.cestName = cestName;
        postDos = new ArrayList<>();
    }

    public void add(PostDo postDo) {
        postDos.add(postDo);
    }

    public String getCestCode() {
        return cestCode;
    }

    public String getCestName() {
        return cestName;
    }

    public ArrayList<PostDo> getPostDos() {
        return postDos;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.cestCode);
        dest.writeString(this.cestName);
        dest.writeTypedList(postDos);
    }

    protected PostMapBo(Parcel in) {
        this.cestCode = in.readString();
        this.cestName = in.readString();
        this.postDos = in.createTypedArrayList(PostDo.CREATOR);
    }

    public static final Parcelable.Creator<PostMapBo> CREATOR = new Parcelable.Creator<PostMapBo>() {
        @Override
        public PostMapBo createFromParcel(Parcel source) {
            return new PostMapBo(source);
        }

        @Override
        public PostMapBo[] newArray(int size) {
            return new PostMapBo[size];
        }
    };
}
